fix stackfilter issues. (#324)
authortsteven4 <tsteven4@users.noreply.github.com>
Wed, 13 Mar 2019 17:13:07 +0000 (11:13 -0600)
committerGitHub <noreply@github.com>
Wed, 13 Mar 2019 17:13:07 +0000 (11:13 -0600)
1. correct defect in the new RouteList::swap method.
2. correct an old bug in stackfilter that cleaned up
waypts on exit, but not routes or tracks.
3. enhance stackfilter test to test routes and tracks as well
as waypts.

route.cc
stackfilter.cc
testo.d/stackfilter.test

index c3b5742ab4a3543f64b296ed6b6970d29d0296c5..81b7ff3989a5b5b88a6f66cedd51c9cda5cc4060 100644 (file)
--- a/route.cc
+++ b/route.cc
@@ -521,8 +521,8 @@ RouteList::restore(RouteList* src)
 void RouteList::swap(RouteList& other)
 {
   const RouteList tmp_list = *this;
-  other = *this;
-  *this = tmp_list;
+  *this = other;
+  other = tmp_list;
 }
 
 void RouteList::sort(Compare cmp)
index c50f5445d03e504c86be1dbb7e97eea09f8ce491..3721ab25ae8d9e605f63ca4930b9686415c67c23 100644 (file)
@@ -166,6 +166,8 @@ void StackFilter::exit()
   }
   while (stack) {
     waypt_flush(&(stack->waypts));
+    stack->routes.flush();
+    stack->tracks.flush();
     tmp_elt = stack;
     stack = stack->next;
     delete tmp_elt;
index bc25122c90f5155e213ef55f35e9328b5696186a..25ab1b89b84f9707a90ffb0cca72f035e39624af 100644 (file)
@@ -7,3 +7,7 @@
 
 gpsbabel -i geo -f ${REFERENCE}/../geocaching.loc -x stack,push,copy,nowarn -x stack,push,copy -x stack,push -x stack,pop,replace -x stack,pop,append -x stack,push,copy -x stack,pop,discard -x stack,swap,depth=1 -o arc -F ${TMPDIR}/stackfilt.txt
 
+gpsbabel -i geo -f ${REFERENCE}/../geocaching.loc -x transform,rte=wpt,del -x stack,push,copy,nowarn -x stack,push,copy -x stack,push -x stack,pop,replace -x stack,pop,append -x stack,push,copy -x stack,pop,discard -x stack,swap,depth=1 -o arc -F ${TMPDIR}/stackfilt.txt
+
+gpsbabel -i geo -f ${REFERENCE}/../geocaching.loc -x transform,trk=wpt,del -x stack,push,copy,nowarn -x stack,push,copy -x stack,push -x stack,pop,replace -x stack,pop,append -x stack,push,copy -x stack,pop,discard -x stack,swap,depth=1 -o arc -F ${TMPDIR}/stackfilt.txt
+